home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Games / Pararena 1.3 / source / Parts ƒ / Globals.p < prev    next >
Encoding:
Text File  |  1991-05-16  |  5.2 KB  |  232 lines  |  [TEXT/PJMM]

  1. unit Globals;
  2.  
  3. interface
  4.     uses
  5.         Sound;
  6.  
  7.     const
  8.         stackSize = 24000;
  9.         sleep = 2;
  10.         suspendResumeBit = $0001;
  11.         resuming = 1;
  12.  
  13.         kPauseKey = $30;
  14.  
  15.         mainWndoID = 128;
  16.         backPictID = 2001;
  17.         yesNoAlertID = 128;
  18.         aboutDialID = 129;
  19.         unlockDialID = 130;
  20.         hiscoreDialID = 131;
  21.         helpPlayDialID = 132;
  22.         helpRulesDialID = 133;
  23.         speedDialID = 134;
  24.         soundDialID = 135;
  25.         physicsDialID = 136;
  26.  
  27.         mApple = 128;
  28.         iNothing = 0;
  29.         iAbout = 1;
  30.  
  31.         mGame = 129;
  32.         iBegin = 1;
  33.         iEnd = 2;
  34.         iWhichGame = 4;
  35.         iWhichOpponent = 5;
  36.         iQuit = 7;
  37.  
  38.         mWhichGame = 130;
  39.         iPractice = 1;
  40.         iFourofFive = 3;
  41.         iFourOfNine = 4;
  42.         iFirstTo13 = 5;
  43.         iDeltaFive = 6;
  44.  
  45.         mOpponents = 131;
  46.         iMara = 1;
  47.         iOtto = 2;
  48.         iGeorge = 3;
  49.         iClaire = 4;
  50.  
  51.         mOptions = 132;
  52.         iVisCurs = 1;
  53.         iAutoPickUp = 2;
  54.         iSound = 3;
  55.         iSpeed = 4;
  56.         iPhysics = 5;
  57.         iHelpRules = 7;
  58.         iHelpOther = 8;
  59.         iHiScores = 10;
  60.  
  61.         noSound = 0;
  62.         lowPriority = 1;
  63.         highPriority = 2;
  64.  
  65.         south = 0;
  66.         southEast = 1;
  67.         east = 2;
  68.         northEast = 3;
  69.         north = 4;
  70.         northWest = 5;
  71.         west = 6;
  72.         southWest = 7;
  73.         resting = 8;
  74.         notCarrying = 0;
  75.         carrying = 1;
  76.         crouching = 2;
  77.  
  78.         noone = 0;                    {Opponents}
  79.         mara = 1;
  80.         otto = 2;
  81.         george = 3;
  82.         claire = 4;
  83.  
  84.         practiceSkating = 0;        {Game in session}
  85.         practiceWBall = 1;
  86.         fourOfFive = 2;
  87.         fourOfNine = 3;
  88.         firstToThirteen = 4;
  89.         deltaFive = 5;
  90.  
  91.         ballNotInArena = 0;        {Ball states}
  92.         nooneHasBall = 1;
  93.         playerHasBall = 2;
  94.         opponentHasBall = 3;
  95.  
  96.         noFriction = 0;
  97.         weakFriction = 1;
  98.         normalFriction = 2;
  99.         strongFriction = 3;
  100.  
  101.         centerH = 256;
  102.         centerV = 200;
  103.  
  104.     type
  105.         dynaMap = record
  106.                 dest: Rect;
  107.                 oldDest: Rect;
  108.                 src: Rect;
  109.                 mask: Rect;
  110.                 posX: LongInt;
  111.                 posZ: LongInt;
  112.                 velX: LongInt;
  113.                 velZ: LongInt;
  114.                 screenH: Integer;
  115.                 screenV: Integer;
  116.                 mode: Integer;
  117.                 carryMode: Integer;
  118.                 timeKeeper: LongInt;
  119.             end;
  120.  
  121.         vertHandle = ^vertPtr;
  122.         vertPtr = ^vert;
  123.         vert = record
  124.                 data: array[0..80, -80..80] of Integer;
  125.             end;
  126.  
  127.         savedScores = record
  128.                 greatNames: array[0..11] of Str255;
  129.                 deltaNames: array[0..11] of Str255;
  130.                 greatScores: array[0..11, 0..1] of Integer;
  131.                 deltaScores: array[0..11, 0..1] of Integer;
  132.             end;
  133.  
  134.         forceHandle = ^forcePtr;
  135.         forcePtr = ^force;
  136.         force = record
  137.                 data: array[-24..24, -24..24, 0..1] of Integer;
  138.             end;
  139.  
  140.     var
  141.         theEvent: EventRecord;
  142.  
  143.         mainWndo: WindowPtr;
  144.         screenArea, wholeScreen: Rect;
  145.         offVirginMap, offLoadMap, offPlayerMap, offEnemyMap: BitMap;
  146.         offVirginPort, offLoadPort, offPlayerPort, offEnemyPort: GrafPtr;
  147.         offVirginBits, offLoadBits, offPlayerBits, offEnemyBits: Ptr;
  148.  
  149.         earthPoints, taygetePoints, numerator, denominator, wasMBarHeight, timeToLock: Integer;
  150.         earthFouls, taygeteFouls, lastTouchingBall, frictNum, frictDen, frictState: Integer;
  151.         whichOpponent, whichGame, whichPeriod, mouseConst, delayTime, numberOfStars: Integer;
  152.         smallestDelta, smallestGreatest, rightOffset, downOffset, tileLit, tileToggle: Integer;
  153.         massNumbers: array[0..4, 0..1] of Integer;
  154.         stars: array[0..44, 0..1] of Integer;
  155.         modeOpposites: array[0..20] of Integer;
  156.         nontantTable: array[0..8] of Integer;
  157.         forceTable: array[-24..24, -24..24, 0..1] of Integer;
  158.         mouseForce: array[0..8, 0..1] of Integer;
  159.  
  160.         periodTime, startTime, currentTime, lastLoopTime: LongInt;
  161.  
  162.         prefsStr, playerName: Str255;
  163.         ballCatches: array[0..5] of Str255;
  164.  
  165.         chanPtr: sndChannelPtr;
  166.         soundPriority: Integer;
  167.         theSnd: Handle;
  168.  
  169.         foulSrc: Rect;
  170.         player, opponent, ball: dynaMap;
  171.         vertTable: vertHandle;
  172.         theForces: forceHandle;
  173.         ballVisRgn, wholeRgn: RgnHandle;
  174.         hiScores: savedScores;
  175.  
  176.         cursorArray: array[0..8] of CursHandle;
  177.         titleLetters: array[0..7] of dynaMap;
  178.         tileRgns: array[0..5, 0..1] of RgnHandle;
  179.         foulDest: array[0..1, 1..3] of Rect;
  180.         periodDest: array[1..4] of Rect;
  181.         titleSrc, titleMask: array[0..7] of Rect;
  182.         digitSrc: array[0..16] of Rect;
  183.         timeDest, earthScoreDest, taygeteScoreDest: array[1..3] of Rect;
  184.         jetsRects: array[0..2] of Rect;
  185.         teleportMask: array[0..3] of Rect;
  186.         playerSrc, playerMask, opponentSrc: array[0..8, 0..2] of Rect;
  187.  
  188.         soundOn, playing, pausing, clicked, jetsOut, opponentWants, mad, autoPickUp: Boolean;
  189.         ballJustHit, locked, inhibitSound, lastButton, doneFlag, hasWNE, inColor: Boolean;
  190.         bothJustHit, opponentDropping, cursorVis, scoresChanged, justQuit, inBackground: Boolean;
  191.         soundArray: array[1..5] of Boolean;
  192.  
  193.     procedure CenterDialog (dialID: Integer);
  194.     procedure FatalError;
  195.  
  196. {=================================}
  197.  
  198. implementation
  199.  
  200. {=================================}
  201.  
  202.     procedure CenterDialog;
  203.         var
  204.             dialHandle: DialogTHndl;
  205.             dialRect: Rect;
  206.             dummyInt: Integer;
  207.     begin
  208.         dialHandle := DialogTHndl(Get1Resource('DLOG', dialID));
  209.         if dialHandle <> nil then
  210.             begin
  211.                 HNoPurge(Handle(dialHandle));
  212.                 dialRect := dialHandle^^.boundsRect;
  213.                 OffsetRect(dialRect, -dialRect.left, -dialRect.top);
  214.                 dummyInt := (screenBits.bounds.right - dialRect.right) div 2;
  215.                 OffsetRect(dialRect, dummyInt, 0);
  216.                 dummyInt := (screenBits.bounds.bottom - dialRect.bottom + 20) div 2;
  217.                 OffsetRect(dialRect, 0, dummyInt);
  218.                 dialHandle^^.boundsRect := dialRect;
  219.                 HPurge(Handle(dialHandle));
  220.             end;
  221.     end;
  222.  
  223. {=================================}
  224.  
  225.     procedure FatalError;
  226.     begin
  227.         ExitToShell;
  228.     end;
  229.  
  230. {=================================}
  231.  
  232. end.